# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=scout2
pkgver=1182.5d86d46
pkgrel=3
pkgdesc='Security auditing tool for AWS environments.'
groups=('blackarch' 'blackarch-scanner' 'blackarch-fuzzer')
url='http://isecpartners.github.io/Scout2/'
arch=('any')
license=('GPL2')
depends=('python2' 'python2-boto3' 'python2-dateutil' 'python2-netaddr'
         'python2-opinel' 'python2-botocore' 'python2-jmespath'
         'python2-iampoliciesgonewild')
makedepends=('git')
source=("$pkgname::git+https://github.com/iSECPartners/Scout2.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" README.rst
  install -Dm 644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
  install -Dm 644 Scout2.py "$pkgdir/usr/share/$pkgname/Scout2.py"

  rm LICENSE README.rst

  cp -a * "$pkgdir/usr/share/$pkgname/"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec python2 Scout2.py "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

